home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-22 | 2.6 KB | 71 lines | [TEXT/X_#a] |
- ; Tutorial 9: Lathing and Extrusion
-
- animate 30 30
-
- ; Modeling real objects (like cars or faces) in 3D requires
- ; that they be approximated with large numbers of polygons,
- ; perhaps thousands of polygons per object. You won't want
- ; to do anything so complicated with xModels-3D. But it
- ; does have two ways of producing fairly complex, but also
- ; fairly regular, objects. The methods are called lathing
- ; and extrusion. The idea is to take a figure consisting
- ; of a connected sequence of line segments in the xy-plane.
- ; (For extrusion, a polygon is used; for lathing, however,
- ; the final point is not automatically connected back
- ; to the first). Some specified number of copies of this
- ; figure are made and then more line segments are added to
- ; connect corresponding endpoints in the copies. This is
- ; not as complicated as it sounds.
- ;
- ; In lathing, the copies are made by rotating the original
- ; figure about the y-axis. The command for doing lathing
- ; is "lathe":
-
- lathe 8 ; The first parameter is the number of copies,
- 0,5 1,1 3,0 1,-1 0,-5 ; then the list of points.
- yrotate 0::45 ; You can apply transformations
- ; to lathed objects, of course.
-
- ; Compare the figure produced by the above to the polygon
- ; made with the same points:
-
- polygon 0,5 1,1 3,0 1,-1 0,-5
- xtranslate 5 ; move it over so you can see it
-
- ; The extra vertical line from (0,-5) back to (0,5), which
- ; is added to close the polygon, is not used in the lathing
- ; operation. The remaining sides form the figure that is
- ; rotated about the y-axis by the lathe command.
- ;
- ; Here are more examples:
-
- lathe 20 2,2 2,-2 ; Lathing a single line.
- xrotate 0::180 ; Tumble it end-over-end
- xtranslate -7
-
- lathe 4 2,2:-2:2 3,0 ; You can use animation!
- translate -4,7,0
-
- ; Extrusion is not quite so interesting as lathing. In
- ; extrusion, the copies of the original figure are made
- ; by translating the original in the z-direction, instead
- ; of by rotating it. The copies are spaced one unit apart,
- ; although you can change that, of course, by scaling
- ; in the z direction. The extruded figure entends
- ; equally far behind the xy-plane as it does in front
- ; of it. The command for doing extrusion is "extrude".
- ; Here, for example, is a 3D "E":
-
- extrude 2 ; The number of copies.
- 0,0 0,5 3,5 3,4 1,4 1,3 ; List of points.
- 2,3 2,2 1,2 1,1 3,1 3,0
- translate -7.5,-9.5,0
-
- ; And here is an example that rotates so you can see
- ; it better:
-
- extrude 5 -2,-2 0,2 2,-2 ; Extrude 5 copies of
- yrotate -30:30:-30 ; a triangle
- translate 3,-6.5,0
-
-